package com.mobile.weather;

import com.mobile.weather.domain.Users;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    //提供一个接口方法：
    // http://localhost:9191/findUserById/1
//    @RequestMapping("/findUserById/{id}")  //   RestFulAPI
//    public Users findUserById(@PathVariable("id") Integer id){
//
//        System.out.println("into UserController findUserById......9292....");
//
//        return new Users(id,"name"+id);
//    }

    //进行Feign的调用实验时，注意 服务提供者接口编写要规范
    @RequestMapping("/list/{userId}/{businessId}")  // /list/1001/3333
    public String list(@PathVariable("userId") Integer userId,@PathVariable("businessId") Integer businessId){                  return "9292----------list,whose cart2:"+userId+","+businessId;

    }

    //进行Feign的调用实验时，注意 服务提供者接口编写要规范
    @RequestMapping("/listCart")  // /list?uId=1001&bId=3333
    public String listCart(@RequestParam("uId") Integer userId, @RequestParam("bId") Integer businessId){
        return "9191-----------listCart,whose cart:"+userId+","+businessId;
    }


}
